import React, { Component } from 'react'

export default class App extends Component {
  state = {
    age: 18,
  }
  handleClick = () => {
    this.setState({
      age: this.state.age + 1
    }, () => {
      console.log(this.state.age);
    })
  }
  render () {
    return (
      <div>
        <p>{this.state.age}</p>
        <button onClick={this.handleClick}>+1</button>
      </div>
    )
  }
}